﻿using System.Collections.Generic;

namespace UFrame
{
    public class TreeStruct<T>
    {
        //private int mId;
        private T mValue;
        private TreeStruct<T> mParent;
        private List<TreeStruct<T>> mChildren = new List<TreeStruct<T>>();

        //public int Index
        //{
        //    get
        //    {
        //        return mId;
        //    }
        //}

        public T Value
        {
            get { return mValue; }

            set { mValue = value; }
        }

        public List<TreeStruct<T>> Children
        {
            get { return mChildren; }
        }

        public TreeStruct<T> Parent
        {
            get { return mParent; }

            set { mParent = value; }
        }

        public bool IsChildrenNull()
        {
            return mChildren == null || mChildren.Count == 0;
        }

        public virtual void AddChild(TreeStruct<T> node)
        {
            node.Parent = this;
            mChildren.Add(node);
        }
    }
}